package com.googlecode.gingerman.robot;

import java.util.List;

public class Radio {

	private List<WallInfo> Walls;
	private List<EnemyRobotInfo> EnemyRobots;
	private int idCmd;
	
	public Radio(int idCmd)
	{
		this.idCmd=idCmd;
	}
	
	public  List<WallInfo> getWalls() {
		return Walls;
	}
	
	
	
	public List<EnemyRobotInfo> getEnemyRobots()
	{
		return EnemyRobots;
	}
	
	public void addEnemyRobot(EnemyRobotInfo enemyrobot){
		boolean notfound=true;
		int lastfound=0;
		for (int i=0;i<=EnemyRobots.size()-1;i++)
		{
			if (enemyrobot.equals(EnemyRobots.get(i))){
				notfound=false;
				lastfound=i;
			}
				
		}
		if (notfound){
			EnemyRobots.add(enemyrobot);
		}
		if (notfound==false){
			EnemyRobots.remove(lastfound);
			EnemyRobots.add(enemyrobot);
		}
		
		
		
	}
	
	public void addWall(WallInfo wall){
		boolean notfound=true;
		for (int i=0;i<=Walls.size()-1;i++)
		{
			if (Walls.get(i).getX()==wall.getX() && Walls.get(i).getY()==wall.getY() && Walls.get(i).getAngle()==wall.getAngle()
					&& Walls.get(i).getHeigth()==wall.getHeigth() && Walls.get(i).getWidth()==wall.getWidth()) notfound=false;
		}
		if (notfound)  Walls.add(wall);
	}
	
	public EnemyRobotInfo getNearestEnemy(int x,int y)
	{
		return 
	}
	
	public void step()
	{
		for (int i=0;i<=EnemyRobots.size()-1;i++){
			EnemyRobots.get(i).incStep();
		}
	}
}
